<span page-title>{{ 'Create Content View' | translate }}</span>

<section data-extend-template="layouts/details-page-with-breadcrumbs.html">
  <header data-block="header">
    <h2 translate>Create Content View</h2>
  </header>

  <div class="row">
    <form name="optionsForm" class="col-sm-12">
      <label class="radio-inline" ng-hide="true">
        <input type="radio"
               ng-model="createOption"
               name="createOptions"
               id="createOptions1"
               value="new"
               checked/>
        {{ "Create new view" | translate }}
      </label>
      <label class="radio-inline" ng-hide="true">
        <input type="radio"
               ng-model="createOption"
               name="createOptions"
               id="createOptions2"
               value="existing"/>
        {{ "Create view from existing views" | translate }}
      </label>
    </form>
  </div>

  <div data-block="content" class="row">
    <form name="contentViewForm" class="col-sm-5" novalidate role="form">
      <div bst-form-group label="{{ 'Name' | translate }}">
        <input id="name"
               name="name"
               ng-model="contentView.name"
               type="text"
               tabindex="1"
               autofocus
               required/>
      </div>

      <div bst-form-group label="{{ 'Label' | translate }}">
        <input id="label"
               name="label"
               ng-model="contentView.label"
               type="text"
               tabindex="2"
               required/>
      </div>

      <div bst-form-group label="{{ 'Description' | translate }}">
        <textarea id="description"
                  name="description"
                  ng-model="contentView.description"
                  tabindex="3">
        </textarea>
      </div>

      <div bst-form-group ng-hide="contentView.import_only">
        <div class="checkbox">
          <label for="composite">
            <input id="composite"
                   name="composite"
                   ng-model="contentView.composite"
                   type="checkbox"
                   tabindex="4"/>
            <span translate>Composite View</span>
          </label>
        </div>
        <p class="help-block" translate>A composite view contains other content views.</p>
      </div>

      <div bst-form-group ng-hide="!importOnlyEnabled() || contentView.composite">
        <div class="checkbox">
          <label for="import_only">
            <input id="import_only"
                   name="import_only"
                   ng-model="contentView.import_only"
                   type="checkbox"
                   tabindex="4"/>
            <span translate>Import-only</span>
          </label>
        </div>
        <p class="help-block" translate>Designate whether this Content View is for importing from an upstream server. Import-only Content Views can not be published directly.</p>
      </div>

      <div bst-form-group ng-hide="contentView.composite || contentView.import_only">
        <div class="checkbox">
          <label for="solve_dependencies">
            <input id="solve_dependencies"
                   name="solve_dependencies"
                   ng-model="contentView.solve_dependencies"
                   type="checkbox"
                   tabindex="4"/>
            <span translate>Solve Dependencies</span>
          </label>
        </div>
        <p class="help-block" translate>
          This will solve RPM and Module Stream dependencies on every publish of this Content View. Dependency solving significantly increases
          publish time (publishes can take over three times as long) and filters will be ignored when adding packages to solve
          dependencies. Also, certain scenarios involving errata may still cause dependency errors.
        </p>
      </div>

      <div bst-form-group ng-show="contentView.composite">
        <div class="checkbox">
          <label for="auto_publish">
            <input id="auto_publish"
                   name="auto_publish"
                   ng-model="contentView.auto_publish"
                   type="checkbox"
                   tabindex="5"
                   ng-disabled="!contentView.composite"/>
            <span translate>Auto Publish</span>
          </label>
        </div>
        <p class="help-block" translate>Applicable only for composite views. Auto publish composite view when a new version of a component content view is created. Also note auto publish will only happen when the component is marked "latest".</p>
      </div>

      <div bst-form-buttons
           on-cancel="transitionTo('content-views')"
           on-save="save(contentView)"
           working="working">
      </div>
    </form>
  </div>
</section>
